//
//  housListTableViewCell.m
//  sellHouse
//
//  Created by 李 佳伟 on 2018/11/23.
//  Copyright © 2018年 李 佳伟. All rights reserved.
//

#import "housListTableViewCell.h"
#import "JTCSM.h"
#import "HouserInfoModel.h"

static CGFloat imagewidth = 125;
static CGFloat imageheight = 94;

@interface housListTableViewCell ()

@property (nonatomic,strong) UIImageView *logoimagev;
@property (nonatomic,strong) UILabel *titleLabel;
@property (nonatomic,strong) UILabel *moneyLabel;
@property (nonatomic,strong) UILabel *stausLabel;
@property (nonatomic,strong) UILabel *timeLabel;

@end

@implementation housListTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.logoimagev = [[UIImageView alloc]initWithFrame:CGRectMake(Kspace, Kspace, imagewidth, imageheight)];
        [self.contentView addSubview:self.logoimagev];
        CGFloat labelWidth = KSCREENWidth-Kspace-imagewidth-12-Kspace;
        
        self.titleLabel = [UILabel initWithFrame:CGRectMake(KVIEW_X(self.logoimagev)+12, Kspace, labelWidth, 16) text:@"西岗区绕山路小区中心位置" font:16 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(89, 89, 89, 1) backgroundColor:nil];
        [self.contentView addSubview:_titleLabel];
        
        CGFloat changespace = 40;
        self.moneyLabel = [UILabel initWithFrame:CGRectMake(KVIEW_X(self.logoimagev)+12, KVIEW_Y(_titleLabel)+14, labelWidth-changespace, 12) text:@"期望售价:130万" font:12 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(193, 193, 193, 1) backgroundColor:nil];
        [self.contentView addSubview:_moneyLabel];
        
        self.stausLabel = [UILabel initWithFrame:CGRectMake(KVIEW_X(self.logoimagev)+12, KVIEW_Y(_moneyLabel)+14, labelWidth-changespace, 12) text:@"房屋状态:正常" font:12 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(193, 193, 193, 1) backgroundColor:nil];
        [self.contentView addSubview:_stausLabel];
        
        self.timeLabel = [UILabel initWithFrame:CGRectMake(KVIEW_X(self.logoimagev)+12, KVIEW_Y(_stausLabel)+14, labelWidth-changespace, 12) text:@"提交时间:2018-11-22" font:12 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(193, 193, 193, 1) backgroundColor:nil];
        [self.contentView addSubview:_timeLabel];
        
        CGFloat imagesize = 30;
        self.touchImagev = [[UIImageView alloc]initWithFrame:CGRectMake(KSCREENWidth-20-imagesize, (cellHeight-imagesize)/2, imagesize, imagesize)];
        self.touchImagev.image = [UIImage imageNamed:@"choice.jpg"];
        self.touchImagev.hidden = YES;
        [self.contentView addSubview:self.touchImagev];
        [df lineViewWithHeightofTop:cellHeight superView:self.contentView lineHeight:10 space:0];
        
    }
    return self;
}

- (void)setvalueWithModel:(id)model{
    HouserInfoModel *mymodel = model;
    
    [self.logoimagev sd_setImageWithURL:KImageUrl(mymodel.imgUrl) placeholderImage:[UIImage imageNamed:@"imagenull1.jpg"]];
    self.titleLabel.text = [NSString stringWithFormat:@"%@",mymodel.address];
    self.moneyLabel.text = [mymodel.saleStatus integerValue]==6?@"期望售价: --" :[NSString stringWithFormat:@"期望售价: %@万元",mymodel.totalPrice];
    [df fuwenbenLabel:self.moneyLabel FontNumber:[UIFont systemFontOfSize:12] AndRange:NSMakeRange(5, self.moneyLabel.text.length-5) AndColor:RGBACOLOR(255, 135, 38, 1)];
    self.stausLabel.text = [NSString stringWithFormat:@"房屋状态: %@",mymodel.statusStr];
    self.timeLabel.text = [NSString stringWithFormat:@"提交时间: %@",mymodel.createDateStr];
}
@end
